//
//  ViewController.m
//  Test
//
//  Created by iD Student on 6/26/13.
//  Copyright (c) 2013 iD Student. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{
    test.text = @"Does it work?";
    resetLabel = @"Reset";
    changeLabel = @"Test";
    swap = YES;
    [reset setTitle: (resetLabel) forState:UIControlStateNormal];
    [change setTitle: (changeLabel) forState:UIControlStateNormal];
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (IBAction) action: (id)sender;
{
    UIButton *buttonPressed = (UIButton*) sender;
    
    if(swap == YES)
    {
        if(buttonPressed == change)
        {
            if([test.text  isEqual: @"Does it work?"])
            {
                test.text = @"It does.";
            }
            else{
                test.text = @"So does this.";
            }
            
            
        }
        else if(buttonPressed == reset)
        {
        test.text = @"Does it work?";
        }
    }
    else if(swap == NO){
        if(buttonPressed == reset)
        {
            if([test.text  isEqual: @"Does it work?"])
            {
                test.text = @"It does.";
            }
            else{
                test.text = @"So does this.";
            }
            
            
        }
        else if(buttonPressed == change)
        {
            test.text = @"Does it work?";
        }
    }
}
- (IBAction) switch: (id)sender;
{
    
    if([resetLabel isEqual: @"Reset"]){
        resetLabel = @"Test";
        changeLabel = @"Reset";
    }
    else{
        resetLabel = @"Reset";
        changeLabel = @"Test";
    }
    [reset setTitle: (resetLabel) forState:UIControlStateNormal];
    [change setTitle: (changeLabel) forState:UIControlStateNormal];
}
- (IBAction) switchFunction: (id)sender;
{
    if(swap == YES){
        swap = NO;
    }
    else if(swap == NO){
        swap = YES;
    }
}
@end
